<template>
	<view class="page">
		<!-- 搜索 -->
		<view class="search_head">
			<view class="search_heads">
				<u-icon class="search_icon" name="search" @click="get_product_batch_process_area()"></u-icon>
				<input type="text" value="" v-model="keyword" placeholder="请输入产品名称或溯源流程" />
			</view>
		</view>
		<!-- 列表 -->
		<view class="list_item" v-for="(item,index) in list" :key="index" @click="get_history(item.product_batch_id)">
			<view class="item_title">
				{{item.product_name}}
			</view>
			<view class="item_content">
				{{item.batch_name}} <text>编号：{{item.batch_number}}</text>
			</view>
			<view class="itme_info">
				<image class="item_info_head_img" :src="item.cover_pic" mode=""></image>
				<view class="item_info_head">
					<view class="item_info_title">
						{{item.goods_name}}
					</view>
					<view class="item_info_price">
						{{item.price}}
					</view>
				</view>
			</view>
			<view class="item_time">
				操作于 {{item.updated_at}}
			</view>
		</view>
	</view>
</template>

<script>
	import source from "../../api/source/index.js";
	export default {
		data() {
			return {
				keyword:'',
				list:[]
			}
		},
		created(){
			
		},
		onLoad(e) {
			this.get_product_batch_process_area();
		},
		methods: {
			get_history(product_batch_id){
				uni.navigateTo({
					url:'../history/history?product_batch_id=' + product_batch_id
				})
			},
			get_product_batch_process_area(){
				source.product_batch_process_area({keyword:this.keyword}).then((res) => {
					if(res.code == 0){
						this.list = res.data.list;
					}else{
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
					}
				})
			},
			get_null(){},
			get_show(){
				this.show_type=!this.show_type
			}
		}
	}
</script>

<style scoped>
	.item_time{
		width: 95%;
		margin: 0 auto;
		margin-top: 24rpx;
		font-size: 24rpx;
		color: #8C8C8C;
	}
	.item_info_price{
		margin-top: 2rpx;
		font-size: 30rpx;
		color: #F0250E;
		font-weight: 600;
	}
	.item_info_title{
		width: 100%;
		font-size: 28rpx;
		color: #262626;
			overflow:hidden;
			white-space:nowrap; /*不允许换行*/
			text-overflow:ellipsis;/*超出部分省略号显示*/
	}
	.item_info_head{
		width: 70%;
		margin-left: 20rpx;
	}
	.item_info_head_img{
		width: 90rpx;
		height: 90rpx;
		border-radius: 25rpx;
	}
	.itme_info{
		width: 95%;
		margin: 0 auto;
		margin-top: 24rpx;
		border-radius: 25rpx;
		background: #F5F5F5;
		padding: 5rpx 5rpx;
		display: flex;
		align-items: center;
	}
	.item_content text{
		margin-left: 24rpx;
	}
	.item_content{
		width: 95%;
		margin: 0 auto;
		padding-top: 10rpx;
		font-size: 24rpx;
		color: #8C8C8C;
	}
	.item_title{
		width: 95%;
		margin: 0 auto;
		font-size: 30rpx;
		color: #262626;
		font-weight: 600;
	}
	.list_item{
		width: 95%;
		margin: 0 auto;
		margin-top: 24rpx;
		border-radius: 25rpx;
		background: #fff;
		padding: 30rpx 0;
	}
	/* 列表 */
	.search_heads input{
		margin-left: 4rpx;
		color: #9B9B9B;
		font-size: 26rpx;
		width: 90%;
	}
	.search_icon{
		margin-left: 24rpx;
	}
	.search_heads{
		width: 95%;
		height: 64rpx;
		background: #F2F2F2;
		border-radius:25rpx ;
		display: flex;
		align-items: center;
	}
	.search_head{
		width: 100%;
		height: 100rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		background-color: #fff;
	}
	/* <!-- 搜索 --> */
	.page {
		background: rgb(242, 242, 242);
		min-height: 100vh;
		width: 100%;
	}
</style>
